<template>
  <div>
    <Player/>
    <!-- banner -->
    <div class="banner" id="banner1">
      <a @click="$router.push('/dashboard')"
         style="color: white;font-size: small;position: relative;top:70px;left: 1300px;font-weight: bold"
         class="banner-title">首页</a>
      <a @click="$router.push('/myblog')"
         style="color: white;font-size: small;position: relative;top:70px;left: 1300px;font-weight: bold"
         class="banner-title">我的博客</a>
      <a @click="$router.push('/message')"
         style="color: white;font-size: small;position: relative;top:70px;left: 1300px;font-weight: bold"
         class="banner-title">留言</a>

      <a @click="$router.push('/blogStore')"
         style="color: white;font-size: small;position: relative;top:70px;left: 1300px;font-weight: bold"
         class="banner-title">商城</a>
      <h1 class="banner-title">江湖</h1>
    </div>
    <div style="margin-top: 300px;margin-left: -140px" class="blog-container" >
      <el-row style="margin-left: 370px" v-for="(item,index) in form" >
        <el-col :span="16" style="margin-top: 10px">
          <el-card :body-style="{ padding: '10px' }" style="height: 250px;width: 950px" class="img1">
            <div v-if="index%2 === 0" style="display: flex;" >
              <!--图片-->
              <div style=" height:250px;width:400px" class="img1">
                <img style=" height:100%;width:100%"
                     :src="item.img" />
              </div>
              <!--内容-->
              <div style="padding: 14px;">
                <a @click="open(item)"><h2 style="margin-top: -0px;font-weight:normal" id="click">{{item.title}}</h2></a>
                <p style="margin-top: -4px;font-size: smaller;margin-left: 1px;margin-top: 39px">{{item.title}}</p>
                <el-avatar :src="item.avatar" style="position: relative;top: 28px;height: 25px;width: 25px"></el-avatar>
                <span style="font-size: small;position: relative;top: 20px;margin-left: 8px">{{item.author}}</span>
                <span style="font-size: small;position: relative;top: 20px;margin-left:10px">分类：{{item.category}}</span>
                <span class="svg-container" style="margin-left: 20px">
                  <svg-icon icon-class="time" style="position: relative;top: 20px;"/>
                  <span style="font-size: small;position: relative;top: 20px;">{{item.time}}</span>
                </span>
              </div>

            </div>
            <div v-else style="display: flex;flex-direction: row;justify-content: space-between;" >

              <!--内容-->
              <div style="padding: 14px;">
                <a @click="open(item)"><h2 style="margin-top: -0px;font-weight:normal" >{{item.title}}</h2></a>
                <p style="margin-top: -4px;font-size: smaller;margin-left: 1px;margin-top: 39px">{{item.title}}</p>
                <el-avatar :src="item.avatar" style="position: relative;top: 28px;height: 25px;width: 25px"></el-avatar>
                <span style="font-size: small;position: relative;top: 20px;margin-left: 8px">{{item.author}}</span>
                <span style="font-size: small;position: relative;top: 20px;margin-left:10px">分类：{{item.category}}</span>
                <span class="svg-container" style="margin-left: 20px">
                  <svg-icon icon-class="time" style="position: relative;top: 20px;"/>
                  <span style="font-size: small;position: relative;top: 20px;">{{item.time}}</span>
                </span>
              </div>
              <!--图片-->
              <div style=" height:250px;width:400px" class="img1">
                <img style=" height:100%;width:100%"
                     :src="item.img" />
              </div>
            </div>

          </el-card>
        </el-col>

      </el-row>

    </div>
    <div app padless absolute style="margin-top: -90px">
      <div class="footer-wrap">
        <div>©2021 - {{ new Date().getFullYear() }} By chenchao</div>
        <a href="" target="_blank">
          邮箱：2776895893@qq.com
        </a>
      </div>
    </div>
  </div>
</template>


<script>
  import '../assets/index.css'
  import request from '../utils/request'
  import Player from '../components/zw-player/player.vue'
import '../../public/ribbon'
  export default {
    components: { Player },
    name: 'Show',
    data() {
      return {
        form: []
      }
    },
    created() {
      request.get('/news').then(res => {
        console.log(res)
        this.form = res.data.reverse()
      })
    },
    methods: {

      open(item) {
        // this.vis = true
        // if (item) {
        //   // console.log(item)
        //   this.tmpItem = item
        // }
        console.log(item)
        let id = item.id
        this.$router.push({
          path: '/Detail/',
          query: { id }
        })
      },

    }
  }

</script>


<style scoped>
  img{
    transition: all 3s;
  }
  img:hover{
    transform: scale(1.06);
  }

.img1:hover{
  background: skyblue;
  box-shadow: 0px 5px 10px #777;
  /*transform: scale(1.1);*/
}
.img1{

  box-shadow: 0 0 0px #ccc;
  transition: all 2s;

}


  #banner1 {
    background: url('../assets/png/1.jpg') no-repeat center center/cover;
  }
  .footer-wrap {
    width: 100%;
    line-height: 2;
    position: relative;
    padding: 40px 20px;
    color: #eee;
    font-size: 14px;
    text-align: center;
    background: linear-gradient(-45deg, #ee7752, #ce3e75, #23a6d5, #23d5ab);
    background-size: 400% 400%;
    animation: Gradient 10s ease infinite;
  }
  .footer-wrap a {
    color: #eee !important;
  }

  @keyframes Gradient {
    0% {
      background-position: 0 50%;
    }
    50% {
      background-position: 100% 50%;
    }
    100% {
      background-position: 0 50%;
    }
  }
  .home-banner {
    position: absolute;
    top: -60px;
    left: 0;
    right: 0;
    height: 100vh;
    background-attachment: fixed;
    text-align: center;
    color: #fff !important;
    animation: header-effect 1s;
  }

  .banner-container {
    margin-top: 43vh;
    line-height: 1.5;
    color: #eee;
  }

  .blog-contact a {
    color: #fff !important;
  }

  .card-info-social {
    line-height: 40px;
    text-align: center;
    margin: 6px 0 -6px;
  }

  .card-info-social a {
    font-size: 1.5rem;
  }

  .left-radius {
    border-radius: 8px 0 0 8px !important;
    order: 0;
  }

  .right-radius {
    border-radius: 0 8px 8px 0 !important;
    order: 1;
  }

  .article-wrapper {
    font-size: 14px;
  }

  @media (min-width: 760px) {
    .blog-title {
      font-size: 2.5rem;
    }

    .blog-intro {
      font-size: 1.5rem;
    }

    .blog-contact {
      display: none;
    }

    .home-container {
      max-width: 1200px;
      margin: calc(100vh - 48px) auto 28px auto;
      padding: 0 5px;
    }

    .article-card {
      display: flex;
      align-items: center;
      height: 280px;
      width: 100%;
      margin-top: 20px;
    }

    .article-cover {
      overflow: hidden;
      height: 100%;
      width: 45%;
    }

    .on-hover {
      transition: all 0.6s;
    }

    .article-card:hover .on-hover {
      transform: scale(1.1);
    }

    .article-wrapper {
      padding: 0 2.5rem;
      width: 55%;
    }

    .article-wrapper a {
      font-size: 1.5rem;
      transition: all 0.3s;
    }
  }

  @media (max-width: 759px) {
    .blog-title {
      font-size: 26px;
    }

    .blog-contact {
      font-size: 1.25rem;
      line-height: 2;
    }

    .home-container {
      width: 100%;
      margin: calc(100vh - 66px) auto 0 auto;
    }

    .article-card {
      margin-top: 1rem;
    }

    .article-cover {
      border-radius: 8px 8px 0 0 !important;
      height: 230px !important;
      width: 100%;
    }

    .article-cover div {
      border-radius: 8px 8px 0 0 !important;
    }

    .article-wrapper {
      padding: 1.25rem 1.25rem 1.875rem;
    }

    .article-wrapper a {
      font-size: 1.25rem;
      transition: all 0.3s;
    }
  }

  .scroll-down {
    cursor: pointer;
    position: absolute;
    bottom: 0;
    width: 100%;
  }

  .scroll-down i {
    font-size: 2rem;
  }

  .article-wrapper a:hover {
    color: #8e8cd8;
  }

  .article-info {
    font-size: 95%;
    color: #858585;
    line-height: 2;
    margin: 0.375rem 0;
  }

  .article-info a {
    font-size: 95%;
    color: #858585 !important;
  }

  .article-content {
    line-height: 2;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
  }

  .blog-wrapper {
    position: sticky;
    top: 10px;
  }

  .blog-card {
    line-height: 2;
    padding: 1.25rem 1.5rem;
  }

  .author-wrapper {
    text-align: center;
  }

  .blog-info-wrapper {
    display: flex;
    justify-self: center;
    padding: 0.875rem 0;
  }

  .blog-info-data {
    flex: 1;
    text-align: center;
  }

  .blog-info-data a {
    text-decoration: none;
  }

  .collection-btn {
    text-align: center;
    z-index: 1;
    font-size: 14px;
    position: relative;
    display: block;
    background-color: #49b1f5;
    color: #fff !important;
    height: 32px;
    line-height: 32px;
    transition-duration: 1s;
    transition-property: color;
  }

  .collection-btn:before {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: -1;
    background: #ff7242;
    content: "";
    transition-timing-function: ease-out;
    transition-duration: 0.5s;
    transition-property: transform;
    transform: scaleX(0);
    transform-origin: 0 50%;
  }

  .collection-btn:hover:before {
    transition-timing-function: cubic-bezier(0.45, 1.64, 0.47, 0.66);
    transform: scaleX(1);
  }

  .author-avatar {
    transition: all 0.5s;
  }

  .author-avatar:hover {
    transform: rotate(360deg);
  }

  .web-info {
    padding: 0.25rem;
    font-size: 0.875rem;
  }

  .scroll-down-effects {
    color: #eee !important;
    text-align: center;
    text-shadow: 0.1rem 0.1rem 0.2rem rgba(0, 0, 0, 0.15);
    line-height: 1.5;
    display: inline-block;
    text-rendering: auto;
    -webkit-font-smoothing: antialiased;
    animation: scroll-down-effect 1.5s infinite;
  }

  @keyframes scroll-down-effect {
    0% {
      top: 0;
      opacity: 0.4;
      filter: alpha(opacity=40);
    }
    50% {
      top: -16px;
      opacity: 1;
      filter: none;
    }
    100% {
      top: 0;
      opacity: 0.4;
      filter: alpha(opacity=40);
    }
  }

  .big i {
    color: #f00;
    animation: big 0.8s linear infinite;
  }

  @keyframes big {
    0%,
    100% {
      transform: scale(1);
    }
    50% {
      transform: scale(1.2);
    }
  }
</style>
